home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / utility / horst_2.zip / READ.ME2 < prev    next >
Text File  |  1995-12-18  |  13KB  |  247 lines

  1.  
  2.                              -*- HORST_2.LZH -*-
  3.  
  4. 14 May 1995
  5. ---------------------------------------------------------------------------
  6.  
  7.  This this file contains expanded discussions of some of the programs 
  8.  contained in the HORST_2 archive, plus background material.  It is 
  9.  intended for relative beginners to batch programming and won't be needed 
  10.  by BATPOWER old hands!  Please direct criticisms, suggestions and 
  11.  comments to Robert Bull at Fidonet 2:254/33.4, as it may be extended in 
  12.  further versions.  The material was checked by Horst before inclusion.
  13.  
  14. ---------------------------------------------------------------------------
  15.  
  16.  Files added to the archive by Robert Bull;
  17.  
  18.  READ.ME2      (this file)
  19.  ECHECK.BAT    very simple batch file to demonstrate errorlevels
  20.  SCRPCHK.BAT   uses CRC32 and NSET to check files encoded with CSCRIPT
  21.  H4.BAT        uses QECHO to send control codes to a LaserJet 4 Plus
  22.                (needs PMENUE as well)
  23.  SHUTDOWN.BAT  uses DREADY to make sure the disk drives are empty before
  24.                turning off the computer
  25.  
  26. ---------------------------------------------------------------------------
  27.  
  28.                         A note for 4DOS / NDOS users
  29.  
  30.  4DOS and NDOS, a version of 4DOS sold with Norton Utilities, are very much 
  31.  enhanced replacements for COMMAND.COM, DOS's own command processor.  Users 
  32.  of those excellent products will be aware that there is some overlap 
  33.  between 4DOS built-in commands and Horst's utilities, but they are 
  34.  completely compatible, as far as is known.  You may well prefer Horst's 
  35.  programs for some jobs.  In particular, computer support staff may not be 
  36.  given the chance to install 4DOS on all of a company's PCs; it is 
  37.  therefore nice to know that other utilities are available to do some of 
  38.  the same jobs, and that those jobs be set up on a 4DOS machine with 
  39.  complete confidence that they will run properly on a plain one.
  40.  
  41. ---------------------------------------------------------------------------
  42.  
  43.                                 Descriptions
  44.  
  45.  ANSTRIP       
  46.  
  47.  Many batch files contain ANSI control codes.  These are usually used to 
  48.  give colourful screens, but can also be used to redefine the keyboard 
  49.  or to move the cursor.  ANSTRIP strips ANSI codes out of text files for 
  50.  a clean display on non-ANSI monitors, and helps in converting batch 
  51.  files to non-ANSI use.  ANSTRIP has a feature to remove keyboard 
  52.  redefinitions only, but this NOT a secure way of avoiding ANSI bombs, 
  53.  i.e., malicious redefinitions of the keyboard so that innocent actions 
  54.  like DIR cause destructive actions like DEL *.*. 
  55.  
  56.  
  57. ---------------------------------------------------------------------------
  58.  
  59.  CSCRIPT
  60.  CRC32
  61.  example: SCRPCHK.BAT, which feeds a file to DEBUG for decoding, and 
  62.  tells you whether the CRC's matched.  Needs NSET also.
  63.  SCRPCHK.BAT has been commented.
  64.  
  65.  Most bulletin-board system (BBS) users know about downloading files.  Some 
  66.  even know about uploading files.  Few know that files can be transmitted 
  67.  through normal e-mail as messages, as long as they are encoded.  If you 
  68.  look at many files types, such as .COM files, .EXE files and archives 
  69.  (.ZIP, .LZH, etc.) with a file lister such as Buerg's LIST.COM, you will 
  70.  see they are full of funny-looking high-ASCII characters, owing to the way 
  71.  the files are stored on disk.  These characters can cause e-mail systems 
  72.  to crash, so encoding systems have been invented to replace them with 
  73.  ordinary alphanumeric characters (plus a few others).  They are then 
  74.  reassembled at the other end with a suitable decoder; conveniently, this 
  75.  is DEBUG, which comes free with most versions of DOS.  Many small but 
  76.  useful files have been shared around the Fidonet BATPOWER echo this way.  
  77.  
  78.  CRC checking is a way of checking that a file has not been corrupted.  
  79.  A calculation of its contents is made and presented as a number.  
  80.  CSCRIPT adds this number to the tail of each file it encodes.  You run 
  81.  CRC32 over the file you have just decoded with DEBUG and check that the 
  82.  CRC values match.  
  83.  
  84.  While often very useful and much appreciated, transmitting scripts 
  85.  takes up a lot of bandwidth in an echo and costs everyone (especially 
  86.  sysops) money in telephone costs.  Therefore, please check the echo 
  87.  rules to make sure that posting files as scripts is actually allowed, 
  88.  please restrict such postings to files specifically intended to help 
  89.  somebody out of a hole (i.e. no unsolicited postings to "All"), please 
  90.  don't post files already widely available, and please keep postings to 
  91.  files of reasonable size.
  92.  
  93.  The earlier version of CSCRIPT, 1.x, was primarily intended for small 
  94.  files.  It had a size limit of 12K but should not be used for files 
  95.  exceeding a few hundred bytes.  If your file is bigger than that, Chad 
  96.  Wagner's XXBUG (3.0 at the time of writing) is most popular, but many 
  97.  prefer the "official" method of UU or XX encoding, as exemplified by 
  98.  Richard E. Marks' UUDECODE (UUEXE525).
  99.  
  100.  Horst Schaeffer's new CSCRIPT ver. 2.2 now includes options for XX- and
  101.  UUencoding (with or without DEBUG header), and still has a reasonable
  102.  program size (about 1.400 bytes).  It is small enough to be encoded as a 
  103.  script for transmission through the e-mail system without imposing an 
  104.  unreasonable burden on the bandwidth, and takes up little hard disk space.  
  105.  Multi-page scripts, however, are not supported.
  106.  
  107.  
  108. ---------------------------------------------------------------------------
  109.  
  110.  ESPACE
  111.  example: ECHECK.BAT (a very simple example to demonstrate use of 
  112.  errorlevels)
  113.  
  114.  Ever had one of those "out of environment space" messages?  Here's a 
  115.  way of avoiding them.  ESPACE reports how much environment space is 
  116.  left, and, optionally, whether there is as much left as you specify.  
  117.  This means that you can take action before starting a batch file that 
  118.  uses a lot of environment space.  If there is less than you know 
  119.  the .BAT needs, try loading a second copy of the command processor, 
  120.  i.e., issue the command
  121.  
  122.  COMMAND /E:nnnn
  123.  
  124.  which gives you a secondary DOS shell with another nnnn bytes of 
  125.  environment space.  nnnn = 2048 seems quite a good figure.
  126.  
  127.  
  128. ---------------------------------------------------------------------------
  129.  
  130.  NOEMPTY
  131.  
  132.  NOEMPTY is a filter for removing blank lines from files.  You wouldn't 
  133.  often do this with normal document files, but it is useful when dealing 
  134.  with sorted lists, perhaps those produced by other filters which in 
  135.  deleting lines have left them blank.  I used an AWK one-liner before I 
  136.  had NOEMPTY, but NOEMPTY is faster (four times faster!) and more 
  137.  reliable.
  138.  
  139.  Horst also made LISTMOD ignore blank lines, so you can in fact use 
  140.  LISTMOD as a no-empty filter as well.  Two things to note; (a) LISTMOD 
  141.  has a 60K input file size limit, and (b) LISTMOD will left-justify all 
  142.  output when used like this, which you may or may not want, depending on 
  143.  circumstances.
  144.  
  145. ---------------------------------------------------------------------------
  146.  
  147.  KPUSH
  148.  
  149.  Some batch file operations can't be fully automated because at some point 
  150.  or other a certain key has to be pressed.  Often there is good reason for 
  151.  your full attention, but on occasion you have a routine operation to 
  152.  perform and find it a nuisance.  The IBM PC-compatible has a keyboard 
  153.  buffer, that is, a small section of memory that can hold up to 15 
  154.  keystrokes at a time.  The main purpose of this is to catch extra 
  155.  keystrokes when you type faster than a program can accept them, so that 
  156.  they are not lost, but released as fast as the program can react.  KPUSH 
  157.  is a program that allows you to stuff keypresses into that buffer, usually 
  158.  from a batch file, allowing you to perform many actions hands-off.
  159.  
  160.  KPUSH has another function.  It can tell you the correct codes for keys 
  161.  you want to enter into a KPUSH script.  If you issue the command KPUSH at 
  162.  the command line, it announces its presence and puts a flashing cursor on 
  163.  the screen.  If you then press a key, KPUSH returns that key's "scan 
  164.  code,"  as well as its ASCII code, where it has one.  The scan code is the 
  165.  value the key returns to DOS when it is pressed.  It is important to know 
  166.  that this is not the same as the ASCII value marked on the key top.  Some 
  167.  keys, like cursor and function keys, do not have ASCII values, but they do 
  168.  have scan codes.  Conversely, the grey "+" key on the numeric keypad has a 
  169.  different scan code from the white "+" key on the main keyboard, even 
  170.  though they have the same ASCII values.  Any key can be KPUSHed into the 
  171.  buffer by using its scan code.
  172.  
  173.  Having only 15 keypresses can be limiting.  Horst has overcome this by 
  174.  making KPUSH extend the buffer to 127 characters.  That should be enough 
  175.  for most people but if you do need even more, try keyboard buffer 
  176.  extenders such as BIGBUF.SYS.
  177.  
  178.  Having keypresses already pending in the buffer before KPUSH was run could 
  179.  cause problems.  KPUSH has a flush feature, which clears the buffer of any 
  180.  keypresses already in it before introducing its own.
  181.  
  182.  Occasionally you will find that KPUSH and similar programs will throw key 
  183.  presses at a program faster than the program can react.  This happens 
  184.  with, for example, some of PC-Write's Alt-{char} font characters, though 
  185.  other stuffed keys behave perfectly.  KPUSH can not overcome this; it 
  186.  would need to be a TSR, a RAM-resident program, an approach which uses 
  187.  memory and can cause conflicts with other programs.  Another problem is 
  188.  when some programs clear the buffer themselves on entry, thereby flushing 
  189.  and losing any keypresses that KPUSH has placed there.  
  190.  
  191.  
  192. ---------------------------------------------------------------------------
  193.  
  194.  QECHO
  195.  example: H4.BAT
  196.           Please note - you need PMENUE as well for this.  PMENUE was 
  197.           included in the previous archive HORST_1.LZH, but will shortly be 
  198.           moved into a separate archive of its own as PMENUE15.LZH, so is 
  199.           not included here.
  200.  
  201.  If you have tried to use DOS's own ECHO command, you will realise that it 
  202.  is pretty limited.  It always ends input with a carriage return whether 
  203.  you want one or not, which can, for example,  add unnecessary blank lines 
  204.  if you use it to control a printer.  Equally, have you ever tried to echo 
  205.  control codes to a printer directly from the command line?  If you tried 
  206.  to send a code sequence that contained the ASCII 027 ESCape character, you 
  207.  probably had the whole line evaporate in front your eyes!  QECHO overcomes 
  208.  these limitations.
  209.  
  210.  For example, I wanted to send control codes to a LaserJet 4 Plus printer.  
  211.  I needed to be able to re-set it after a very expensive commercial program 
  212.  that didn't always get the page length right, to send form feeds (page 
  213.  ejects) after screen prints and the like (the printer is so far from the 
  214.  PC that the control panel is hard to reach!), and also to be able to set 
  215.  certain fonts for printing plain ASCII files from DOS.  A program called 
  216.  SETUP2, originally from PC Magazine, was posted in the BATPOWER echo for 
  217.  just this sort of job.  It turned out to be a rather badly-behaved TSR.  
  218.  When QECHO became available as well as Horst's earlier PMENUE batch 
  219.  menuing program, I hastily converted Horst's own PMENUE demo into H4.BAT 
  220.  so as to work with QECHO to send Hewlett-Packard PCL5 control code 
  221.  sequences, containing the ESCape character amongst others.  There's no 
  222.  guarantee of whether _all_ the control codes in H4.BAT work as advertised; 
  223.  but the re-set and page eject do!  (I feel a modification of this .BAT 
  224.  coming on now Horst has given us PCHECK...)
  225.  
  226.  
  227. ---------------------------------------------------------------------------
  228.  
  229.  DREADY
  230.  example: SHUTDOWN.BAT
  231.  
  232.  I got to work one day only to fume with frustration at finding I'd left a 
  233.  disk I wanted at home.  I knew exactly where it was - in the A: drive of 
  234.  my home machine.  Likewise, I've come into work in the morning, turned the 
  235.  machine on, only to get an error message that the disk was not bootable.  
  236.  I'd left the last of the back-up disks in the floppy drive overnight, 
  237.  thereby making a mockery of trying to keep data safe by keeping a separate 
  238.  copy away from the computer.  Clearly I needed a way of reminding myself 
  239.  to check that the drive was empty.  I habitually run a SHUTDOWN.BAT before 
  240.  turning the computer off, and DREADY gave an excellent way of adding into 
  241.  it a check on the whether there was a floppy in the drive.  The example 
  242.  SHUTDOWN.BAT shows how it is used to check both A: and B: drives of the 
  243.  machine I use at work.
  244.  
  245. ---------------------------------------------------------------------------
  246.  
  247.